package com.kakavr.pay.constant;

import com.kakavr.base.constant.BaseConstant;
import com.kakavr.base.resource.SystemResource;

/**
 * 支付宝支付常量
 * @author gang.yang
 *
 */
public class ALiPayConstant {
	
	/**
	 * 加密RSA2
	 */
	public final static String RSA2 = "RSA2";
	
	/**
	 * ali 数据格式
	 * JSON
	 */
	public final static String ALIPAY_FORMATE = "JSON";
	
	/**
	 * 字符编码格式 目前支持utf-8
	 */
	public final static String ALI_INPUT_CHARSET = "UTF-8";

	/**
	 * 支付宝支付pid
	 */
	private final static String ALIPAY_PID="ALIPAY_PID";
	/**
	 * 支付宝应用私钥
	 */
	private final static String ALIPAY_PRIVATE_KEY="ALIPAY_PRIVATE_KEY";
	/**
	 * 支付宝应用公钥
	 */
	private final static String ALIPAY_APP_PUBLIC_KEY="ALIPAY_APP_PUBLIC_KEY";
	/**
	 * 支付宝公钥 验证支付宝响应
	 */
	private final static String ALIPAY_PUBLIC_KEY="ALIPAY_PUBLIC_KEY";

	/**
	 * 操作成功之后页面
	 */
	public final static String SUCCESS_URL = "redirect:/mach/userRecharge.html";

	/**
	 * 获取支付宝回调地址
	 * 
	 * @return
	 */
	public static String getAlipayNotifyUrl() {
		return BaseConstant.getBaseUrl() + "/shop/n/alipay/alipayNotify";
	}
	/**
	 * 获取支付宝页面跳转地址
	 * 
	 * @return
	 */
	public static String getAlipayReturnUrl() {
		return BaseConstant.getBaseUrl() + "/shop/n/alipay/alipayReturn";
	}

	/**
	 * 获取支付宝pid
	 * 
	 * @return
	 */
	public static String getAlipayPid() {
		return SystemResource.get(ALIPAY_PID);
	}

	/**
	 * 获取支付宝app应用私钥
	 * 
	 * @return
	 */
	public static String getAliAppPrivateKey() {
		return SystemResource.get(ALIPAY_PRIVATE_KEY);
	}

	/**
	 * 获取支付宝app应用公钥
	 * 
	 * @return
	 */
	public static String getAliAppPublicKey() {
		return SystemResource.get(ALIPAY_APP_PUBLIC_KEY);
	}

	/**
	 * 获取支付宝公钥 验证支付宝响应
	 * 
	 * @return
	 */
	public static String getAlipayPublicKey() {
		return SystemResource.get(ALIPAY_PUBLIC_KEY);
	}

}
